﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using Bainx.WPF.Extend;
using Bainx.WPF.Extend.Control;


namespace WM360Client
{
    /// <summary>
    /// SkinWindow.xaml 的交互逻辑
    /// </summary>
    public partial class SkinWindow : WPFBaseWindow
    {
        public SkinWindow()
        {
            InitializeComponent();
            this.TMDSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(TMDSlider_ValueChanged);
            TMDSlider.Maximum = 1;
            TMDSlider.LargeChange = 0.01;
            Loaded += new RoutedEventHandler(SkinWindow_Loaded);
        }
        void SkinWindow_Loaded(object sender, RoutedEventArgs e)
        {
            
        }
        void TMDSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            this.Background = this.Background.OpacityChange(e.NewValue);
            this.DarkBackground = this.DarkBackground.OpacityChange(e.NewValue);

        }     
        protected override void LoadStyleConfigure()
        {
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
        }
        protected override void LoadStyleComponent()
        {
            //this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen
        }
        private List<FileInfo> getLocalBackImages(DirectoryInfo BackImagesDir)
        {
            string[] filetype = new string[] { "*.jpg","*.jpeg","*.png","*.bmp","*.gif"};
            List<FileInfo> LFileInfo = new List<FileInfo>();
            foreach (var type in filetype)
            {
                LFileInfo.AddRange(BackImagesDir.GetFiles(type));
            }
            return LFileInfo;
        }
        private void showLocalBackImagesToWP(IEnumerable<FileInfo> Files)
        {
            foreach (var file in Files)
            {
                PictureBox pb = new PictureBox(new Uri("file:///"+file.FullName));
                WrapPanelBackImages.Children.Add(pb);
            }
        }
    }
}
